package leetcode.interview;

import java.util.HashMap;

/**
 * ClassName: $01_UniqueString
 * Description:
 * date: 2021-09-19 17:38
 *
 * @author liyifan
 */
public class $01_UniqueString {
    public boolean isUnique(String astr) {
        if(astr.length() == 0 || astr.length() == 1)
            return true;
        HashMap<Character, Integer> map = new HashMap<>();
        for(int i = 0; i < astr.length(); i++) {
            if (map.get(astr.charAt(i)) != null)
                return false;
            else
                map.put(astr.charAt(i), 1);
        }
        return true;
    }
}
